package edu.zut.cs.software.example.market.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;

import edu.zut.cs.software.example.domain.BaseEntity;
import edu.zut.cs.software.example.student.domain.Student;

/**
 * 
 * @author 耿昊天
 *
 */

@Entity
@Table(name="product")
public class Product extends BaseEntity<Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5159258760250381041L;



	@Column
	String name; //商品名称
	
	@Column
	String description; //商品描述
	
	@Column
	String tag;  //标签（出售/求购）
	
	@Column
	String sort; //种类
	
	@Column
	String price; //价格
	
	@Column
	String phonenumber; //电话
	
	@Column
	String poster; //发布者
	
	@Column
	private boolean state;
	
	/**
	 * Many product objects relate to one category of product.
	 */
	@Column
	Long studentid;
	
	
	public Product(String name, String description, String tag, String sort, String price, String phonenumber,
			String poster, boolean state, Long studentid) {
		super();
		this.name = name;
		this.description = description;
		this.tag = tag;
		this.sort = sort;
		this.price = price;
		this.phonenumber = phonenumber;
		this.poster = poster;
		this.state = state;
		this.studentid = studentid;
	}
	
	
	public Product() {
		super();
	}



	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	public String getPhonenumber() {
		return phonenumber;
	}

	public void setPhonenumber(String phonenumber) {
		this.phonenumber = phonenumber;
	}

	public String getPoster() {
		return poster;
	}

	public void setPoster(String poster) {
		this.poster = poster;
	}

	public boolean isState() {
        return state;
    }
	
	public void setState(boolean state) {
        this.state = state;
    }

	public Long getStudentid() {
		return studentid;
	}


	public void setStudentid(Long studentid) {
		this.studentid = studentid;
	}


	@Override
	public String toString() {
		return "Product [name=" + name + ", sort=" + sort + ",tag=" + tag + ",phonenumber="+ phonenumber +", price=" + price + ", poster=" + poster + ", state=" + state + ", studentid="+ studentid +"]";
	}
	
}
